<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name', 100)->comment('用户姓名');
            $table->string('email', 191)->nullable()->unique()->comment('邮箱地址');
            $table->string('phone', 20)->nullable()->unique()->comment('手机号码');
            $table->date('birthday')->nullable()->comment('生日');
            $table->text('bio')->nullable()->comment('个人简介');
            $table->timestamp('email_verified_at')->nullable()->comment('邮箱验证时间');
            $table->string('password')->comment('密码哈希');
            $table->boolean('is_active')->default(true)->comment('是否启用，false表示禁用');
            $table->rememberToken();
            $table->timestamps();
            
            // 添加索引
            $table->index('is_active');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};
